summaryrefslogtreecommitdiff
path: root/src/pages/blog/micro/[page].astro
diff options
context:
space:
mode:
authorJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-06-28 18:14:22 -0300
committerJoão Augusto Costa Branco Marado Torres <torres.dev@disroot.org>2025-06-28 18:14:22 -0300
commit79fd506d30eef3d113f4a8e3ab9ebd9004f1e8cc (patch)
tree96ff57c92e897c3cc3331e23043d20f1665c7d0a /src/pages/blog/micro/[page].astro
parenta1eac976b20e39f86d5944fbec68e2a0f8ffb746 (diff)
feat: index page
Signed-off-by: João Augusto Costa Branco Marado Torres <torres.dev@disroot.org>
Diffstat (limited to 'src/pages/blog/micro/[page].astro')
-rw-r--r--src/pages/blog/micro/[page].astro32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/pages/blog/micro/[page].astro b/src/pages/blog/micro/[page].astro
new file mode 100644
index 0000000..9fb04f1
--- /dev/null
+++ b/src/pages/blog/micro/[page].astro
@@ -0,0 +1,32 @@
+---
+import MicroBlog from "@components/templates/MicroBlog.astro";
+import Base from "@layouts/Base.astro";
+import { fromPosts, isMicro } from "@lib/collection/helpers";
+import { identity } from "@utils/anonymous";
+import type {
+ GetStaticPaths,
+ InferGetStaticParamsType,
+ InferGetStaticPropsType,
+} from "astro";
+
+export const getStaticPaths = (async ({ paginate }) => {
+ const micros = await fromPosts(isMicro, identity);
+
+ return paginate(micros, { pageSize: 20 });
+}) satisfies GetStaticPaths;
+
+export type Params = InferGetStaticParamsType<typeof getStaticPaths>;
+export type Props = InferGetStaticPropsType<typeof getStaticPaths>;
+
+const { page } = Astro.props;
+---
+<Base title="Micro Blogue">
+ <h1>Page {page.currentPage}</h1>
+ <ul>
+ {page.data.map((micro) => <li><MicroBlog {...micro} /></li>)}
+ </ul>
+ {page.url.first ? <a href={page.url.first}>First</a> : null}
+ {page.url.prev ? <a href={page.url.prev}>Previous</a> : null}
+ {page.url.next ? <a href={page.url.next}>Next</a> : null}
+ {page.url.last ? <a href={page.url.last}>Last</a> : null}
+</Base>